@echo off
@REM curl --output "install.bat" --ssl-no-revoke "https://gitee.com/yxphope/server/raw/main/install.bat"
@REM install.bat
echo Please run in administrator
where python > nul 2>&1
if %errorlevel% equ 0 (
    echo Python installed
) else (
    echo Python not installed, preparing to download python
    curl --output "python_installer.exe" "https://www.python.org/ftp/python/3.12.3/python-3.12.3-amd64.exe"
    echo installing Python
    python_installer /quiet InstallAllUsers=1 PrependPath=1 Include_test=0 AssociateFiles=0 Shortcuts=0
)
echo Creating D:/Server for saving the program
mkdir "D:/Server"
attrib +h +s "D:/Server"
echo Download program files
curl --output "D:/Server/requirements.txt" --ssl-no-revoke "https://gitee.com/yxphope/server/raw/main/requirements.txt"
curl --output "D:/Server/Server.py" --ssl-no-revoke "https://gitee.com/yxphope/server/raw/main/Server.py"
echo Install the required library
pip3 install -r "D:/Server/requirements.txt"
echo Start running server and updating the project
python "D:/Server/Server.py" --update
pause